package NG::Gen::Task::Spy;
use strict;
use warnings;
use utf8;

our @ISA = qw(NG::Gen::Task::Task);

sub before_done {
	my $self = shift;
	return $self->attach_random;
}
sub before_assign {
	my $self = shift;
	unless($self->check_condition){
		return "Не выполняются условия";
	}
	return 0;
}

sub delay {
	my $self = shift;
	my $param = $self->param;
	
	my $unit_speed = $param->{unit_speed};

	my $ul = $self->{leader}->units->get_by_key($unit_speed,1);
	my $count_speed = 1 + (@$ul && $ul->[0]->count);

	my $delay = int($param->{delay_base} * (1 - $param->{delay_per} * $count_speed / 100));
	return $delay || 1;
}

1;
